package com.brp.dao;

import com.brp.po.Sale;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.brp.vo.SaleVo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;

import java.lang.reflect.Type;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author all
 * @since 2022-03-16
 */
public interface SaleMapper extends BaseMapper<Sale> {
    @Select("insert into t_sale (sale_id, sale_time, fk_user_id, sale_address) VALUES (null,now(),(select client_id from t_client where client_name = #{userName}),#{saleAddress})")
    @SelectKey(before = false,keyColumn = "sale_id",keyProperty = "saleId",
            statement = "select last_insert_id()",resultType = Integer.class)
    Integer insertSale(SaleVo saleVo);
}
